using System.Collections.ObjectModel;
using System.Linq;
using Common;
using Common.Enum;

namespace SSettings.ExperimentColumn
{
	public class AQColumns : GridColumns
	{
		protected int _ColumnCount;

		public AQColumns()
		{
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.CellName",
				Header = Utility.GetMessage("reaction_well"),
				Info = 1,
				Display = false,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Project.BasicInfo.Name",
				Header = Utility.GetMessage("Project"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.SampleName",
				Header = Utility.GetMessage("sample_name"),
				Info = 5,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.TubeName",
				Header = Utility.GetMessage("tube_name"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.ChannelNo",
				Header = Utility.GetMessage("Channel"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Dye",
				Header = Utility.GetMessage("Dye"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.TargetName",
				Header = Utility.GetMessage("Target"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.LineColor",
				Header = Utility.GetMessage("Color"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.SampleType",
				Header = Utility.GetMessage("Type"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Property",
				Header = Utility.GetMessage("property"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.CompoundTubeNo",
				Header = Utility.GetMessage("repl_id"),
				Info = 1,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CtValue",
				Header = Utility.GetMessage("Ct"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CtMean",
				Header = Utility.GetMessage("CtMean"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CtSD",
				Header = Utility.GetMessage("CtSD"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CtCV",
				Header = Utility.GetMessage("CtCV") + "(%)",
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CnValue",
				Header = Utility.GetMessage("Cn"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CnMean",
				Header = Utility.GetMessage("CnMean"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CnSD",
				Header = Utility.GetMessage("CnSD"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.CnCV",
				Header = Utility.GetMessage("CnCV") + "(%)",
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.RnValue",
				Header = Utility.GetMessage("Rn"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			InitCustomColumn();
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.MidValue",
				Header = Utility.GetMessage("mid_value"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "SampleTargetItem.Result.ConclusionList",
				Header = Utility.GetMessage("Prj_Conclusion"),
				Info = 2,
				AllowDelete = false,
				AllowEditing = false
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.ID",
				Header = Utility.GetMessage("sample_index"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Name",
				Header = Utility.GetMessage("patient_name"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Sex",
				Header = Utility.GetMessage("sample_sex"),
				Info = 4,
				Type = EColumnType.ComboBox,
				DataSource = new ObservableCollection<string>
				{
					Utility.GetMessage("male"),
					Utility.GetMessage("female")
				},
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Age",
				Header = Utility.GetMessage("sample_age"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Specimen",
				Header = Utility.GetMessage("sample_specimen"),
				Info = 4,
				Type = EColumnType.ComboBox,
				DataSource = new ObservableCollection<string>
				{
					Utility.GetMessage("serum"),
					Utility.GetMessage("sputa")
				},
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.SpecimenDate",
				Header = Utility.GetMessage("sample_specimen_date"),
				Info = 4,
				Type = EColumnType.DateTime,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Doctor",
				Header = Utility.GetMessage("sample_doctor"),
				Type = EColumnType.ComboBox,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Office",
				Header = Utility.GetMessage("sample_office"),
				Info = 4,
				Type = EColumnType.ComboBox,
				DataSource = new ObservableCollection<string>
				{
					Utility.GetMessage("internal_medicine"),
					Utility.GetMessage("gynaecology_obstetrics"),
					Utility.GetMessage("dermatology"),
					Utility.GetMessage("pediatrics")
				},
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Diagnosis",
				Header = Utility.GetMessage("sample_diagnosis"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.CaseID",
				Header = Utility.GetMessage("sample_case_id"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.BedID",
				Header = Utility.GetMessage("sample_bed_id"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.InPatientID",
				Header = Utility.GetMessage("sample_inpatient_id"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.OutPatientID",
				Header = Utility.GetMessage("sample_outpatient_id"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
			_Columns.Add(new ColumnInfo
			{
				FieldName = "WellCell.Well.Sample.PatientInfo.Remark",
				Header = Utility.GetMessage("sample_remark"),
				Info = 4,
				AllowDelete = false,
				AllowEditing = true
			});
		}

		protected override GridColumns CreateColumns()
		{
			return new AQColumns();
		}

		protected virtual void InitCustomColumn()
		{
		}

		public override void SetVisibilityDefault()
		{
			base.SetVisibilityDefault();
			foreach (ColumnInfo column in _Columns)
			{
				column.Visibility = !string.IsNullOrEmpty(column.FieldName);
			}
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Dye").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "WellCell.Well.Sample.CompoundTubeNo").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.CtMean").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.CtSD").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.CtCV").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.CnMean").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.CnSD").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.CnCV").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.RnValue").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "SampleTargetItem.Result.MidValue").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "WellCell.Well.Sample.PatientInfo.BedID").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "WellCell.Well.Sample.PatientInfo.InPatientID").FirstOrDefault().Visibility = false;
			_Columns.Where((ColumnInfo s) => s.FieldName == "WellCell.Well.Sample.PatientInfo.OutPatientID").FirstOrDefault().Visibility = false;
		}
	}
}
